home *** CD-ROM | disk | FTP | other *** search
- /*
- * xknn.h
- *
- * Practical Algorithms for Image Analysis
- *
- * Copyright (c) 1997, 1998, 1999 MLMSoftwareGroup, LLC
- */
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- #include <malloc.h>
- #include <search.h>
-
- #include "ip.h"
-
- /*
- * Structures for KNN points
- */
-
- struct KNN {
- int x_pos; /* x-coordinate */
- int y_pos; /* y-coordinate */
- int distSqd; /* distance squared from point */
- };
-
- struct Point {
- int x_pos; /* x-coordinate */
- int y_pos; /* y-coordinate */
- struct KNN *Knn; /* pointer to the KNN for this point */
- int nNN; /* number of nearest neighbors found */
-
- };
-
- /*
- * Function prototypes
- */
- extern int main (int, char **);
- extern void usage (char *);
- struct Point *readPoints (char *, int);
- #if defined(LINUX)
- extern int sortX (struct Point *p1, struct Point *p2);
- extern int sortY (struct Point *p1, struct Point *p2);
- #else
- extern int sortX (const void *point1, const void *point2);
- extern int sortY (const void *point1, const void *point2);
- #endif
- extern void find_knn (struct Point *, int, int, int);
- extern int insertNN (struct Point *, struct Point *, long, int);
-